#!/bin/bash

#Set the workflow area
#WF_ROOT=/usr/local/devel/ANNOTATION/workflow-2.1/
WF_ROOT=/home/sreenath/source/workflow

echo "WF_ROOT is : ${WF_ROOT}"

# Change location to the directory '/home/condor/test_cluster/testing', which contains the 
# all the required data files to run the tests.
#cd /home/condor/test_cluster/testing
cd ${PWD}
echo "PWD is : ${PWD}"

# Copy the actual instance file that is run on the cluster from the backup directory.
cp backup/*.* .

sed -e "s:<WF_ROOT>:${WF_ROOT}:g" -e "s:<PWD>:${PWD}:g" cluster_test.ini.token > cluster_test.ini
sed -e "s:<PWD>:${PWD}:g" dist.ini.token > dist.ini

echo "Cluster_test.ini file created." 

# Now, create and run the cluster_test.xml from the configuration file 'cluster_test.ini' and 
# the template file 'cluster_test_temp.xml'
#echo "Running the workflow instance file that validates a condor cluster."
#CMD="${WF_ROOT}/RunWorkflow  -t cluster_test_temp.xml -c cluster_test.ini -i cluster_test.xml"
#echo "Command is : ${CMD}"

#CMD="${WF_ROOT}/CreateWorkflow  -t cluster_test_temp.xml -c cluster_test.ini -i cluster_test.xml"
#${WF_ROOT}/CreateWorkflow -t cluster_test_temp.xml -c cluster_test.ini -i cluster_test.xml

#${WF_ROOT}/RunWorkflow  -t cluster_test_temp.xml -c cluster_test.ini -i cluster_test.xml --testcluster --debug

#echo $?
#if [ $? == 0 ]; then   
#	echo "Cluster validated successfully."
#else
#	echo "Cluster validaton failed."
#fi
